import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';

import { Meteor } from 'meteor/meteor';

class lockProjectsCollection extends Mongo.Collection {
    update(selector, modifier) {
        const result = super.update(selector, modifier);
        return result;
    }
    insert(project, callback) {
        const ourLockProjects = project;
        const result = super.insert(ourLockProjects, callback);
        return result;
    }
    remove(selector, callback) {
        const result = super.remove(selector, callback);
        return result;
    }
}

export const lockProjects = new lockProjectsCollection('lockprojects');

lockProjects.deny({
    insert() { return true; },
    update() { return true; },
    remove() { return true; },
});

lockProjects.schema = new SimpleSchema({
    index: {
        label: '对应锁里的下标',
        type: Number,
        optional: true
    },
    pwd:{
        label:'密码',
        type:String
    },
    cardId:{
        label:'卡片id',
        type:String
    },
    type:{
        label:'项目类型',
        type:String
    },
    valid_period: {
        label: '有效期',
        type: Date,
        optional: true
    },
    times: {
        label: '次数',
        type: Number,
        optional: true
    },
    deviceId: {
        label: '锁ＩＤ',
        type: String,
        optional: true
    },
    productNumber:{
        label:'锁类型',
        type:String
    },
    c_date:{
        label:'指纹创建时间',
        type:Date
    },
    name:{
        label:'项目名',
        type:String,
        optional: true
    }

});
lockProjects.attachSchema(lockProjects.schema);
